package com.only4play.practice.invoice.core.entity;

import com.only4play.codegen.processor.api.*;
import com.only4play.codegen.processor.controller.GenController;
import com.only4play.codegen.processor.creator.GenCreator;
import com.only4play.codegen.processor.dto.GenDto;
import com.only4play.codegen.processor.entitymapper.GenObjectMapper;
import com.only4play.codegen.processor.mapper.GenMapper;
import com.only4play.codegen.processor.query.GenQuery;
import com.only4play.codegen.processor.service.GenService;
import com.only4play.codegen.processor.service.GenServiceImpl;
import com.only4play.codegen.processor.updater.GenUpdater;
import com.only4play.codegen.processor.vo.GenVo;
import com.only4play.codegen.support.model.BaseEntity;
import lombok.Data;
import com.only4play.codegen.support.annotation.FieldDesc;
import com.only4play.codegen.support.constants.ValidStatus;
import java.math.BigDecimal;

@GenCreator(pkgName = "com.only4play.practice.invoice.api.model.creator")
@GenUpdater(pkgName = "com.only4play.practice.invoice.api.model.updater")
// findById方法
@GenVo(pkgName = "com.only4play.practice.invoice.api.model.vo")
// findByPage方法
@GenQuery(pkgName = "com.only4play.practice.invoice.api.model.query")
@GenCreateRequest(pkgName = "com.only4play.practice.invoice.model.api.request")
@GenUpdateRequest(pkgName = "com.only4play.practice.invoice.model.api.request")
@GenQueryRequest(pkgName = "com.only4play.practice.invoice.model.api.request")
@GenResponse(pkgName = "com.only4play.practice.invoice.api.model.api.response")
@GenDto(pkgName = "com.only4play.practice.invoice.model.dto")
// 生成serviceImpl
@GenObjectMapper(pkgName = "com.only4play.practice.invoice.core.entitymapper")
// 生成serviceImpl
@GenMapper(pkgName = "com.only4play.practice.invoice.core.mapper")
@GenService(pkgName = "com.only4play.practice.invoice.core.service")
@GenServiceImpl(pkgName = "com.only4play.practice.invoice.core.service.impl")

@GenController(pkgName = "com.only4play.practice.invoice.core.controller")
@GenFeign(pkgName = "com.only4play.practice.invoice.feign")

@Data
public class InvoiceItem extends BaseEntity {

  @FieldDesc(name = "发票id")
  private Long invoiceId;

  @FieldDesc(name = "申请批次号")
  private String applyBatchNo;

  @FieldDesc(name = "商品名称")
  private String skuName;

  @FieldDesc(name = "税收分类编码")
  private String taxCategoryCode;

  @FieldDesc(name = "税率")
  private BigDecimal taxRate;

  @FieldDesc(name = "税收分类")
  private String taxCategory;

  @FieldDesc(name = "金额")
  private Long amount;

  @FieldDesc(name = "发票显示名称")
  private String displayName;

  @FieldDesc(name = "订单数量")
  private Integer count;

  @FieldDesc(name = "单位")
  private String itemUnit;

  @FieldDesc(name = "行号")
  private Integer lineCode;
  private ValidStatus validStatus;

  public void init() {
    setValidStatus(ValidStatus.VALID);
  }

  public void valid(){
    setValidStatus(ValidStatus.VALID);
  }

  public void invalid(){
    setValidStatus(ValidStatus.INVALID);
  }
}
